<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
<title>动态添加一个文本框</title>
<script type="text/javascript">
    function addText(){
        var txt=document.createElement("input");
        txt.type="text";
        txt.name="txt";
        txt.value="动态添加的文本框";
        document.fm1.appendChild(txt);
    }
</script>
</head>
<body>
<form name="fm1">
<input type="button" name="btn1" value="动态添加文本框" onclick="addText()">
</form>
</body>
</html>
